home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SGI Developer Toolbox 6.1
/
SGI Developer Toolbox 6.1 - Disc 4.iso
/
public
/
cdsend
/
db_get_TOC.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-08-01
|
627b
|
28 lines
#include <string.h>
#include <sys/types.h>
#include <cdaudio.h>
#define MAX_CATALOG (99*3+6+1)
const char *
db_get_TOC( CDPLAYER *cdplayer, CDSTATUS *status )
{
CDTRACKINFO info;
int min, sec, i;
char buf[MAX_CATALOG], *bufp = buf, *tmp;
if (status->state == CD_NODISC || status->state == CD_ERROR)
return (NULL);
sprintf( bufp, "%02d", status->last - status->first + 1 );
bufp += 2;
for (i = status->first; i <= status->last; i++) {
CDgettrackinfo( cdplayer, i, &info );
sprintf( bufp, "%02d%02d", info.total_min, info.total_sec );
bufp += 4;
}
*bufp++ = '\0';
return (strdup( buf ));
}